
#include "iostream"
#include "vector"
#include "unordered_map"
#include "unordered_set"
#include "algorithm"
#include "string"
#include "list"
#include "string.h"

struct State {
    int move_cnt;
    std::string s;
    int kgw;
    State *last = nullptr;

    State(std::string &s, int move_cnt, int kgw) : move_cnt(move_cnt), s(s), kgw(kgw) {}

    State() {}

    int valid_i(int i) {
        while (i < 0) {
            i += s.size();
        }
        i %= s.size();
        return i;
    }

    char &visit(int i) {
        while (i < 0) {
            i += s.size();
        }
        i %= s.size();
        return s[i];
    }

};

class OneLoop {
    std::string begin;
    std::string final;
    std::list<State> queue;
    std::list<State> out_of_queue;
public:
    OneLoop(int a) {
        std::string s1(a, 'W');
        std::string s2(a, 'B');
        this->begin = s1 + " " + s2;
        this->final = s2 + " " + s1;
        State s_res;
        queue.push_back(State(begin, 0, a));
        while (!queue.empty()) {
            out_of_queue.splice(out_of_queue.begin(), queue, queue.begin());
            auto &state = out_of_queue.front();
//            if(state.move_cnt)
//            queue.pop_front();
            if (state.s == final) {
                s_res = state;
                break;
            }
            if (
//                    state.kgw-1>=0&&
//                    state.s[state.kgw-1]
                    state.visit(state.kgw - 1) == 'W') {
                auto state2 = state;
//                std::swap(state2.s[state.kgw-1],state2.s[state.kgw]);
                std::swap(
                        state2.visit(state.kgw - 1),
                        state2.visit(state.kgw));
                state2.kgw--;
                state2.move_cnt++;
                state2.last = &state;
                queue.push_back(state2);
            }
            if (
//                    state.kgw + 1 < state.s.size() &&
                    state.visit(state.kgw + 1) == 'B'
//            state.s[state.kgw + 1] == 'B'
                    ) {
                auto state2 = state;
//                std::swap(state2.s[state.kgw+1],state2.s[state.kgw]);
                std::swap(
                        state2.visit(state.kgw + 1),
                        state2.visit(state.kgw));
                state2.kgw++;
                state2.move_cnt++;
                state2.last = &state;
                queue.push_back(state2);
            }
            if (
//                    state.kgw + 2 < state.s.size() &&
//                state.s[state.kgw + 1] == 'W' &&
//                state.s[state.kgw + 2] == 'B'
                    state.visit(state.kgw + 1) == 'W' &&
                    state.visit(state.kgw + 2) == 'B'
                    ) {
                auto state2 = state;
                std::swap(
                        state2.visit(state.kgw + 2),
                        state2.visit(state.kgw)
                );
//                        state2.s[state.kgw + 2],
//                        state2.s[state.kgw]);
                state2.kgw += 2;
                state2.last = &state;
                queue.push_back(state2);
            }
            if (
                    state.visit(state.kgw - 1) == 'B' &&
                    state.visit(state.kgw - 2) == 'W'
//                    state.kgw - 2 >= 0 &&
//                state.s[state.kgw - 1] == 'B' &&
//                state.s[state.kgw - 2] == 'W'
                ) {
                auto state2 = state;
                std::swap(
                        state2.visit(state.kgw - 2),
                        state2.visit(state.kgw)
                );
//                std::swap(state2.s[state.kgw - 2], state2.s[state.kgw]);
                state2.kgw -= 2;
                state2.last = &state;
                queue.push_back(state2);
            }
        }
        auto final = &out_of_queue.front();
        std::vector<int> stack;
        while (final->last) {
            int a = final->kgw;
            stack.push_back((a) + 1);
            printf("%d %s\n", final->kgw, final->s.c_str());
            final = final->last;
        }
        printf("\n");
//        for (int i = stack.size() - 1; i >= 0; i--) {
//            printf("%d ", stack[i]);
//        };
    }
};

class Solution {
public:
    void run() {

        bool first = true;
        int a;
//        std::string s;
        while (std::cin >> a) {
            OneLoop loop(a);
        }
    }
};

int main() {
//    bool cur_num= true;
    Solution().run();
    return 0;
}

